Dynamic Sub menu C++

Sep 22, 2008 at 8:25am
I have been stumped for about two days now!!!
i cant seem to add another sub menu to the "2" menu dynamically
does anyone know how todo it?
here is an example:
http://www.codeproject.com/KB/menus/DynMenu/DynMenu.gif

1
2
3
HMENU hSubMenu,hMenu;
AppendMenu(hSubMenu, MF_STRING|MF_POPUP, (UINT)hSubMenu, "2");
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "1");


Last edited on Sep 22, 2008 at 8:26am
Sep 22, 2008 at 3:56pm
I had many problems too with thet but the solution is this:

1
2
3
4
5
6
7
8
HMENU hSubMenu,hMenu,hSubSubMenu;
hSubSubMenu=CreatePopupMenu();//this is the important step
hSubMenu=CreatePopupMenu();
hMenu=CreateMenu();
AppendMenu(hSubSubMenu, MF_STRING, (UINT)hSubSubMenu, "3");
AppendMenu(hSubMenu, MF_STRING|MF_POPUP, (UINT)hSubSubMenu, "2");
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "1");
 SetMenu(hWnd,hMenu);

Last edited on Sep 24, 2008 at 3:18pm
Sep 22, 2008 at 9:03pm
wow Bazzy i much appreciate the quick reply i cant thank you enough!
Topic archived. No new replies allowed.